inspector: Handle the dialog more carefully
authorMatthias Clasen <mclasen@redhat.com>
Thu, 3 Jul 2014 02:52:10 +0000 (22:52 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 3 Jul 2014 02:52:10 +0000 (22:52 -0400)
When showing and hiding the inspector window repeatedly without
dismissing the dialog, we were hiding the inspector, but not
the dialog, leading to a confusing user experience.

https://bugzilla.gnome.org/show_bug.cgi?id=732443

gtk/gtkwindow.c

index 45db97374e49b60bd1838a4caaed3b12a5808314..de2057b9bb9f30723cc32f29d07d6c8294a60e81 100644 (file)
@@ -11872,6 +11872,7 @@ warn_response (GtkDialog *dialog,
                gint       response)
 {
   gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_object_set_data (inspector_window, "warning_dialog", NULL);
   if (response == GTK_RESPONSE_NO)
     {
       gtk_widget_destroy (inspector_window);
@@ -11913,9 +11914,12 @@ gtk_window_set_debugging (gboolean enable,
           gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_NO);
           gtk_dialog_add_button (GTK_DIALOG (dialog), _("_OK"), GTK_RESPONSE_YES);
           g_signal_connect (dialog, "response", G_CALLBACK (warn_response), NULL);
+          g_object_set_data (inspector_window, "warning_dialog", dialog);
         }
     }
 
+  dialog = g_object_get_data (inspector_window, "warning_dialog");
+
   if (enable)
     {
       gtk_window_present (GTK_WINDOW (inspector_window));
@@ -11923,7 +11927,11 @@ gtk_window_set_debugging (gboolean enable,
         g_timeout_add (200, show_dialog, dialog);
     }
   else
-    gtk_widget_hide (inspector_window);
+    {
+      if (dialog)
+        gtk_widget_hide (dialog);
+      gtk_widget_hide (inspector_window);
+    }
 }
 
 /**